﻿using MediatR;
using Microsoft.AspNetCore.Http.HttpResults;
using System.ComponentModel.Design;
using T.Basic.API.Appliction.Command.CargoOwnerCommand;
using T.Basic.API.Appliction.Command.LineCommand;
using T.Basic.Domain.T.Basic.Model;
using T.Basic.Repository.BasicInterface;

namespace T.Basic.API.Appliction.CommandHandlers.CargoOwnerHanders
{
    /// <summary>
    /// 新增货主
    /// </summary>
    public class CargoOwnerCreateCommandHandler : IRequestHandler<CargoOwnerCreateCommand, int>
    {
        private readonly ICargoOwnerRepository _CargoOwnerrepository;
        public CargoOwnerCreateCommandHandler(ICargoOwnerRepository cargoOwnerrepository)
        {
            _CargoOwnerrepository = cargoOwnerrepository;
        }
        public async Task<int> Handle(CargoOwnerCreateCommand request, CancellationToken cancellationToken)
        {
            return await _CargoOwnerrepository.AddAsync(request);
           
        }
    }
}
